home *** CD-ROM | disk | FTP | other *** search
/ Network CD 1 / Network CD.iso / converters / pbmplus / doc / libppm.doc < prev    next >
Encoding:
Text File  |  1990-06-20  |  4.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4. ppm(3)                      PBM Plus                       ppm(3)
  5.  
  6.  
  7.  
  8. NAME
  9.      ppm - functions to support portable pixelmap programs
  10.  
  11. SYNOPSIS
  12.      #include <ppm.h>
  13.      cc ... libppm.a libpgm.a libpbm.a
  14.  
  15.  
  16. DESCRIPTION
  17.      TYPES AND CONSTANTS
  18.  
  19.      typedef gray pixval;
  20.      #define PGM_MAXMAXVAL 255
  21.      typedef struct
  22.          {
  23.          pixval r, g, b;
  24.          } pixel;
  25.      extern pixval ppm_pbmmaxval;
  26.  
  27.      Each _p_i_x_v_a_l should contain only the values between _0 and
  28.      _P_G_M__M_A_X_M_A_X_V_A_L.  _p_p_m__p_b_m_m_a_x_v_a_l is the maxval used when a PPM
  29.      program reads a PBM file.  Normally it is 1; however, for
  30.      some programs, a larger value gives better results.
  31.  
  32.      PIXEL MANIPULATIONS
  33.  
  34.      pixval PPM_GETR(p)
  35.      pixel p;
  36.  
  37.      pixval PPM_GETG(p)
  38.      pixel p;
  39.  
  40.      pixval PPM_GETB(p)
  41.      pixel p;
  42.  
  43.      These three macros retrieve the red, green or blue value
  44.      from the given pixel.
  45.  
  46.      void PPM_ASSIGN(p,red,grn,blu)
  47.      pixel p;
  48.      pixval red, grn, blu;
  49.  
  50.      This macro assigns the given red, green and blue values to
  51.      the pixel.
  52.  
  53.      int PPM_EQUAL(p,q)
  54.      pixel p, q;
  55.  
  56.      This macro checks two pixels for equality.
  57.  
  58.      void PPM_CSCALE(newp, p, oldmaxval, newmaxval)
  59.      pixel newp, p;
  60.  
  61.  
  62.  
  63. Printed 5/25/90                                                 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ppm(3)                      PBM Plus                       ppm(3)
  71.  
  72.  
  73.  
  74.      pixval oldmaxval, newmaxval;
  75.  
  76.      This macro scales the colors of pixel _p according the old
  77.      and new maximum values and assigns the new values to _n_e_w_p.
  78.      It is intended to make writing ppmtowhatever easier.
  79.  
  80.      double PPM_LUMIN(p)
  81.      pixel p;
  82.  
  83.      This macro determines the luminance of the pixel _p.
  84.  
  85.      PGM MEMORY MANAGEMENT
  86.  
  87.      pixel **pgm_allocarray(int cols, int rows)
  88.  
  89.      Allocate an array of pixels.
  90.  
  91.      pixel *pgm_allocrow( int cols )
  92.  
  93.      Allocate a row of the given number of pixels.
  94.  
  95.      void pgm_freearray( pixelrow, rows )
  96.  
  97.      Free the array allocated with _p_g_m__a_l_l_o_c_a_r_r_a_y() containing
  98.      the given number of rows.
  99.  
  100.      pbm_freerow( pixelrow )
  101.  
  102.      Free a row of pixels.
  103.  
  104.      READING PBM FILES
  105.  
  106.      void
  107.      ppm_readppminit( file, colsP, rowsP, maxvalP, formatP )
  108.      FILE *file;
  109.      int *colsP, *rowsP, *formatP;
  110.      pixval *maxvalP;
  111.  
  112.      Read the header from a pgm file, filling in the rows, cols,
  113.      maxval and format variables.
  114.  
  115.      void
  116.      ppm_readppmrow( file, pixelrow, cols, maxval, format )
  117.      FILE *file;
  118.      pixel *pixelrow;
  119.      pixval maxval;
  120.      int cols, format;
  121.  
  122.      Read a row of pixels into the pixelrow array.  Format and
  123.      cols were filled in by _p_p_m__r_e_a_d_p_p_m_i_n_i_t().
  124.  
  125.      pixel **
  126.  
  127.  
  128.  
  129. Printed 5/25/90                                                 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ppm(3)                      PBM Plus                       ppm(3)
  137.  
  138.  
  139.  
  140.      ppm_readppm( file, colsP, rowsP, maxvalP )
  141.      FILE *file;
  142.      int *colsP, *rowsP;
  143.      pixval *maxvalP;
  144.  
  145.      Read an entire pixelmap file into memory, returning the
  146.      allocated array and filling in the rows, cols and maxval
  147.      variables.  This function combines _p_p_m__r_e_a_d_p_p_m_i_n_i_t(),
  148.      _p_p_m__a_l_l_o_c_a_r_r_a_y() and _p_p_m__r_e_a_d_p_p_m_r_o_w().
  149.  
  150.      WRITING PGM FILES
  151.  
  152.      void
  153.      ppm_writeppminit( file, cols, rows, maxval )
  154.      FILE *file;
  155.      int cols, rows;
  156.      pixval maxval;
  157.  
  158.      Write the header for a portable pixelmap file.
  159.  
  160.      void
  161.      ppm_writeppmrow( file, pixelrow, cols, maxval )
  162.      FILE *file;
  163.      pixel *pixelrow;
  164.      int cols;
  165.      pixval maxval;
  166.  
  167.      Write a row from a portable pixelmap.
  168.  
  169.      void
  170.      ppm_writeppm( file, bits, cols, rows, maxval )
  171.      FILE *file;
  172.      pixel **bits;
  173.      int cols, rows;
  174.      pixval maxval;
  175.  
  176.      Write the header and all data for a portable pixelmap.  This
  177.      function combines _p_p_m__w_r_i_t_e_p_p_m_i_n_i_t() and _p_p_m__w_r_i_t_e_p_p_m_r_o_w().
  178.  
  179.      pixel ppm_backgroundpixel(pixels, cols, rows)
  180.      pixel **pixels;
  181.      int cols;
  182.      int rows;
  183.  
  184.      Intuit the value of the background.
  185.  
  186. SEE ALSO
  187.      pgm(3), ppm(3)
  188.  
  189. AUTHOR
  190.      Manual by Tony Hansen.
  191.  
  192.  
  193.  
  194.  
  195. Printed 5/25/90                                                 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ppm(3)                      PBM Plus                       ppm(3)
  203.  
  204.  
  205.  
  206.      Copyright (C) 1989 by Jef Poskanzer.
  207.  
  208.      Permission to use, copy, modify, and distribute this
  209.      software and its documentation for any purpose and without
  210.      fee is hereby granted, provided that the above copyright
  211.      notice appear in all copies and that both that copyright
  212.      notice and this permission notice appear in supporting docu-
  213.      mentation.  This software is provided "as is" without
  214.      express or implied warranty.
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. Printed 5/25/90                                                 4
  262.  
  263.  
  264.  
  265.